package com.gaoyi.crm.repository;

import com.gaoyi.crm.db.dao.PmnAttachDao;
import com.gaoyi.crm.db.dao.PmnItemNoDao;
import com.gaoyi.crm.db.entity.PmnAttach;
import com.gaoyi.crm.db.entity.PmnItemNo;
import com.gaoyi.crm.repository.base.BaseRepository;
import com.gaoyi.crm.util.ThreadManager;

import java.util.List;

public class PmnAttachRepository extends BaseRepository<PmnAttach, PmnAttachDao> {
    @Override
    protected int getIndex() {
        return 0;
    }

    @Override
    protected PmnAttachDao getDao() {
        return mDatabase.getPmnTaskAttachDao();
    }

    public void insertPmnAttaches(List<PmnAttach> pmnAttaches) {
        mDao.inserts(pmnAttaches);
    }

    public List<String> getPmnAttaches(String pmnId){
        return mDao.getPmnAttach(pmnId);
    }

    public void deletePmnAttach(String pmnId){
        mDao.deletePmnAttach(pmnId);
    }

    public void updateUploadPath(String id,String path){
        ThreadManager.getInstance().execute(()-> mDao.updateUploadPath(id, path));
    }
}
